Skip to content

김태영 API 구축 코드#1

Open
tae0u0 wants to merge 3 commits intoGDSC-PKNU-Official:mainfrom
tae0u0:main
Open

김태영 API 구축 코드#1
tae0u0 wants to merge 3 commits intoGDSC-PKNU-Official:mainfrom
tae0u0:main

Conversation

@tae0u0
Copy link
Copy Markdown

@tae0u0 tae0u0 commented Jun 1, 2024

UserController를 통해 회원 가입 및 조회, 전체 회원 조회 구현
FortuneController를 통해 GET 요청 시 그날의 운세 전달

Copy link
Copy Markdown
Member

@mjj111 mjj111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다 👍

@@ -0,0 +1,20 @@
<!DOCTYPE HTML>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

호우 ㅋㅋㅋㅋㅋㅋ 프론트까지 😲 대단하십니다

import java.util.*;

@Repository
public class MemoryUserRepository implements UserRepository {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

임시로 메모리기반 레파지토리를 구현하셨군요! 기발하네요 ㅎㅎㅎ

private String loginId;
private String password;

public String getName() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

모두 사용하는 메서드일까요?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헉! 사용하지 않는 게터 세터를 모두 둔다면 객체가 외부에서 쉽게 보여지고, 수정될 수 있는 위험이 있기도 합니다~

public class UserController {
private final UserService userService;

@Autowired
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 애너테이션 없어도 돌아갈거에요 ㅎㅎㅎ

Copy link
Copy Markdown
Contributor

@coke98 coke98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 고생하셨습니다! 결과물도 노션으로 링크 남겨주시면 확인해볼 수 있도록 하겠습니다~!

public class Fortune {
private String fortune;
String[] list = {
"매우 좋음",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

필드 선언시 접근 제한자 잊지말기!

@@ -0,0 +1,5 @@
package com.example.GDSC.model;

public enum Grade {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이넘 활용 좋았습니다~!

private String password;
private Grade grade;

public User(){
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기본 생성자가 필요한 이유, 그리고 해당 코드에서 명시해야하는 이유가 무엇일까요? 세찬님 PR에도 남겨뒀으니 참고해보셔도 좋을 듯 합니다. 답변 남겨주시면 확인하겠습니다~!

private String loginId;
private String password;

public String getName() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헉! 사용하지 않는 게터 세터를 모두 둔다면 객체가 외부에서 쉽게 보여지고, 수정될 수 있는 위험이 있기도 합니다~


import java.util.Optional;
import java.util.List;
public interface UserRepository {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

인터페이스를 활용해주셨네요~👍

@tae0u0
Copy link
Copy Markdown
Author

tae0u0 commented Jun 24, 2024

LGTM 고생하셨습니다! 결과물도 노션으로 링크 남겨주시면 확인해볼 수 있도록 하겠습니다~!

깃허브에 노션 링크를 남기는 거였군요.. 하단에 해당 노션 링크 남겨놨습니다!
https://cosmic-planet-61e.notion.site/Spring-API-df686513b6e048d287cedc61989c130d?pvs=4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants